
#pragma warning(disable : 4819)
#include "Scene.h"
#include <array>
#include "Object.h"

class MakeMapScene : public Scene
{
    enum TerrainIndex
    {
        Empty,        // 空
        ICE,          // 冰
        Junjle,       // 森林
        Water,        // 水
        Iron,         // 铁
        Iron_Top,     // 铁_顶部
        Iron_Left,    // 铁_左侧
        Iron_Bottom,  // 铁_底部
        Iron_Right,   // 铁_右侧
        Brick,        // 砖
        Brick_Top,    // 砖_顶部
        Brick_Left,   // 砖_左侧
        Brick_Bottom, // 砖_底部
        Brick_Right,  // 砖_右侧
        TerrainIndexMax   // 总数
    };
public:
    MakeMapScene();
    ~MakeMapScene();
    void Init() override;
    void HandleEvent(SDL_Event* event) override;
    UpDateResult Update(float deltaTime) override;
    void Render() override;
private:
    void renderTerrain();
    void renderPlayer();
    void saveMap();
    void loadMap(int level);
private:
    SDL_Texture* playerTexture_;
    std::array<std::array<Terrain,MAP_WIDTH>,MAP_HEIGHT> terrains_;
    std::array<Terrain,TerrainIndexMax> terrainObjs_;
    bool isSwitch_ = true;
    SDL_Point currentPos_;
    bool isDraw_ = false;
    TerrainIndex currentIndex_ = Empty;
};